﻿using static System.Console;

Title = "C#中ref引用传递和ref返回值";




int a = 11;
int b = 22;

WriteLine($"交换前a:{a},b:{b}");

Swap(ref a, ref b);

WriteLine($"交换后a:{a},b:{b}");





static void Swap(ref int a, ref int b)
{
    int tmp = a;
    a = b;
    b = tmp;
}

ReadKey();




